<?php 
/* import database connection variables */
require_once __DIR__ . '/db_config.php';

if(!$db){    echo "Purcase DB! :p";    exit();}
$id_produk = $_GET['id_produk'];
if($id_produk==""){	
	$datas2 = array("success"=>0, "message"=>"Required field(s) is missing");	
	$json_format = json_encode($datas2);	
	echo $json_format;	
}else{	
	$datas = array();	
	$get = mysql_query("SELECT * FROM produk WHERE id_produk='".$id_produk."'");	
	$show = array();	
	while($k=mysql_fetch_array($get)){	
		$show[] = array( 
			"id_produk"=>$k["id_produk"], 
			"nama_produk"=>$k["nama_produk"],
			"link_image"=>"http://hanjuang.web.id/foto/foto_produk/".$k["foto"],	
			"komposisi"=>$k["komposisi"],
			"kemasan"=>$k["kemasan"],
			"berat"=>$k["berat"],
			"harga"=>$k["harga"]);	
	}	
	$datas2 = array("success"=>1, "produk" => $show);	
	$json_format = json_encode($datas2);	
	echo $json_format;
}
?>